<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<%@page contentType="text/html" pageEncoding="UTF-8"%>
<!DOCTYPE html>
<html>
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
        <title>JSP Page</title>
    </head>
    <body>
        <form  name="formGioHang" method="post" action="GioHang.jsp">
            <table width="680" border="1" cellspacing="0" cellpadding="0" id="tableformDangNhap">
                <tr>
                    <td bgcolor="#FF0000" height="35" colspan="7" class="menu1" style="text-align:center">
                        <span style="font-weight: bold">GIỎ HÀNG CỦA BẠN</span>
                    </td>
                </tr>
                <tr class="trtenCotGioHang">
                    <td align="center" width="5%" >
                        STT
                    </td>
                    <td align="center" width="17%">
                        Hình
                    </td>
                    <td align="left" width="23%" style="text-align:center">
                        Tên sản phẩm
                    </td>
                    <td align="center" width="15%" style="text-align:center">
                        Số lượng
                    </td>
                    <td align="right" width="12%" style="text-align:center">Giá gốc($)</td>

                    <td colspan="2"  align="center" width="28%" style="text-align:center">Tổng($)</td>



                </tr>
                <c:set var="tongtien" value="0"/>
                <c:if test="${requestScope.ctgh.size() > 0}">
                    <c:forEach var="i" begin="0" end="${requestScope.ctgh.size()-1}" step="1">
                        <c:set var="sp" value="${requestScope.ctgh.get(i)}"/>
                        <c:set var="tongtien" value="${tongtien+requestScope.ctgh.get(i).getDonGia()*requestScope.ctgh.get(i).getSoLuong()}"/>

                        <tr>
                            <td align="center">1</td>
                            <td align="center">
                                <a href="ChiTietSanPham.jsp?MaSanPham=${sp.getMaSanPham()}" title="Click xem chi tiết sản phẩm"><img src="${sp.getHinhAnh()}"  width="80%" height="70" border="0" /></a>
                            </td>
                            <td align="left">
                                <a href="ChiTietSanPham.jsp?MaSanPham=${sp.getMaSanPham()}" title="Click xem chi tiết sản phẩm" class="sanpham_link">${sp.getTenSanPham()}</a>
                            </td>
                            <td align="center">


                                <input name="soLuong" type="number"  disabled="true" value="${sp.getSoLuong()}" size="5" style="width:20px"/>

                            </td>
                            <td align="right"><fmt:formatNumber type="currency" value="${sp.donGia}" /></td>
                            <td align="right"><fmt:formatNumber type="currency" value="${sp.getDonGia() * sp.getSoLuong()}" /></td>
                            <td align="center">&nbsp;</td>
                        </tr>
                    </c:forEach>
                </c:if>
                <tr>
                    <td align="right" colspan="5" >Thành tiền:</td><td colspan="2" align="center" style="color:#C60">   <fmt:formatNumber type="currency" value="${tongtien}" /></td>
                </tr>
                <tr>
                    <td align="right" colspan="5">Phí vận chuyển:</td><td colspan="2" align="center" style="color:#C60">   <fmt:formatNumber type="currency" value="10000" /></td>

                </tr>
                <tr>
                    <td align="right" colspan="5">Tổng tiền thanh toán:</td><td colspan="2" align="center" style="color:#C60">   <fmt:formatNumber type="currency" value="${tongtien+10000}" /></td>

                </tr>

            </table>
        </form>

    </body>
</html>
